<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Symbols</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
function togglePopup(material_id) {
  var popup = document.getElementById(material_id);
  popup.classList.toggle("show");
}
</script>

<link href="../docs-assets/Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'Symbols' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../intern.html">Inter Modules</a></li><li><a href="index.html">bytecode</a></li><li><a href="index.html#2">Chapter 2: The Trees</a></li><li><b>Symbols</b></li></ul></div>
<p class="purpose">To manage named symbols in inter code.</p>

<ul class="toc"><li><a href="2-sym.html#SP1">&#167;1. Creation</a></li><li><a href="2-sym.html#SP5">&#167;5. Status</a></li><li><a href="2-sym.html#SP9">&#167;9. Various sorts of symbol</a></li><li><a href="2-sym.html#SP15">&#167;15. Definition of a symbol</a></li><li><a href="2-sym.html#SP19">&#167;19. Identifier name</a></li><li><a href="2-sym.html#SP20">&#167;20. Translation</a></li><li><a href="2-sym.html#SP21">&#167;21. Replacement</a></li><li><a href="2-sym.html#SP22">&#167;22. Namespace</a></li><li><a href="2-sym.html#SP23">&#167;23. Logging</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. Creation.</b>Each symbol belongs to exactly one symbols table, and thus to exactly one
package; its ID is unique within that table, and therefore package.
</p>

<p class="commentary">Given that design, it might seem a cleaner solution simply to make the
<span class="extract"><span class="extract-syntax">symbol_array</span></span> of a symbols table be an array of <span class="extract"><span class="extract-syntax">inter_symbol</span></span> structures,
rather than (as it actually is) an array of <span class="extract"><span class="extract-syntax">inter_symbol *</span></span> pointers which
point to <span class="extract"><span class="extract-syntax">inter_symbol</span></span> structures stored elsewhere. However:
</p>

<ul class="items"><li>(a) It makes binary loading easier to use this indirection, and
</li><li>(b) It means that pointers to symbols remain valid when symbols tables expand
and then have to dynamically resize their <span class="extract"><span class="extract-syntax">symbol_array</span></span> arrays, which may
in some cases move them in memory.
</li></ul>
<p class="commentary">This all means we have to be careful. The following statements are true:
</p>

<ul class="items"><li>(1) Symbols are created only by symbols tables, and only as a response to
the "creating" version of name lookups.
</li><li>(2) No symbol is ever moved from one table to another.
</li><li>(3) No symbol ever occurs more than once in any table.
</li><li>(4) No symbol ever occurs in more than one table.
</li></ul>
<p class="commentary">But this is false:
</p>

<ul class="items"><li>(5) Every symbol belongs to a table.
</li></ul>
<p class="commentary">Although it is true that every symbol is created in a table, it might later
be struck out with the <a href="2-st.html#SP21" class="internal">InterSymbolsTable::remove_symbol</a> function. If so,
it cannot be reinserted into that or any other table: it is gone forever.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">inter_symbols_table</span><span class="plain-syntax"> *</span><span class="identifier-syntax">owning_table</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">symbol_ID</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">symbol_status</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">identifier</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">definition</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">inter_annotation_set</span><span class="plain-syntax"> </span><span class="identifier-syntax">annotations</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">wiring_data</span><span class="plain-syntax"> </span><span class="identifier-syntax">wiring</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">transmigration_data</span><span class="plain-syntax"> </span><span class="identifier-syntax">transmigration</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">general_pointer</span><span class="plain-syntax"> </span><span class="identifier-syntax">translation_data</span><span class="plain-syntax">;</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure inter_symbol is accessed in 2/pck, 2/st, 2/ann, 2/tw2, 2/trn, 3/iibf, 3/vi, 3/mtd, 4/tcc2, 4/tpc and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. </b>For the reasons given above, this function must only be called from
<a href="2-st.html#SP5" class="internal">InterSymbolsTable::search_inner</a>. If what you want is just to create a
symbol with a particular name, call <a href="2-st.html#SP9" class="internal">InterSymbolsTable::symbol_from_name_creating</a>,
not this.
</p>

<p class="commentary">Note that any symbol whose name matches <a href="3-mtd.html#SP1" class="internal">Metadata::valid_key</a> is made a
metadata symbol: in practice that means if its name begins with <span class="extract"><span class="extract-syntax">^</span></span>.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="function-syntax">InterSymbol::new_for_symbols_table</span><button class="popup" onclick="togglePopup('usagePopup1')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup1">Usage of <span class="code-font"><span class="function-syntax">InterSymbol::new_for_symbols_table</span></span>:<br/>Symbols Tables - <a href="2-st.html#SP5_3">&#167;5.3</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">name</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_symbols_table</span><span class="plain-syntax"> *</span><span class="identifier-syntax">T</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">ID</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">name</span><span class="plain-syntax">) == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"proposed symbol has empty name"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ID</span><span class="plain-syntax"> &lt; </span><span class="constant-syntax">SYMBOL_BASE_VAL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"proposed symbol ID invalid"</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CREATE</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">owning_table</span><span class="plain-syntax"> = </span><span class="identifier-syntax">T</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">symbol_ID</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ID</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">symbol_status</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">identifier</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::duplicate</span><span class="plain-syntax">(</span><span class="identifier-syntax">name</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="3-mtd.html#SP1" class="function-link"><span class="function-syntax">Metadata::valid_key</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">name</span><span class="plain-syntax">)) </span><a href="2-sym.html#SP10" class="function-link"><span class="function-syntax">InterSymbol::make_metadata_key</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><a href="2-sym.html#SP9" class="function-link"><span class="function-syntax">InterSymbol::make_miscellaneous</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">definition</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">annotations</span><span class="plain-syntax"> = </span><a href="2-ann.html#SP10" class="function-link"><span class="function-syntax">SymbolAnnotation::new_annotation_set</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">wiring</span><span class="plain-syntax"> = </span><a href="2-tw2.html#SP1" class="function-link"><span class="function-syntax">Wiring::new_wiring_data</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">transmigration</span><span class="plain-syntax"> = </span><a href="2-trn.html#SP8" class="function-link"><span class="function-syntax">Transmigration::new_transmigration_data</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">translation_data</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL_GENERAL_POINTER</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">INTER_SYMBOLS</span><span class="plain-syntax">, </span><span class="string-syntax">"Created symbol $3 in $4\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">T</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">S</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">inter_package</span><span class="plain-syntax"> *</span><span class="function-syntax">InterSymbol::package</span><button class="popup" onclick="togglePopup('usagePopup2')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup2">Usage of <span class="code-font"><span class="function-syntax">InterSymbol::package</span></span>:<br/><a href="2-sym.html#SP20">&#167;20</a>, <a href="2-sym.html#SP21">&#167;21</a>, <a href="2-sym.html#SP22">&#167;22</a><br/>The Wiring - <a href="2-tw2.html#SP12">&#167;12</a><br/>Transmigration - <a href="2-trn.html#SP5_2_2">&#167;5.2.2</a><br/>The Package Construct - <a href="4-tpc.html#SP11">&#167;11</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="2-st.html#SP3" class="function-link"><span class="function-syntax">InterSymbolsTable::package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">owning_table</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::defined_inside</span><button class="popup" onclick="togglePopup('usagePopup3')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup3">Usage of <span class="code-font"><span class="function-syntax">InterSymbol::defined_inside</span></span>:<br/>Transmigration - <a href="2-trn.html#SP3_5">&#167;3.5</a>, <a href="2-trn.html#SP5_2_2">&#167;5.2.2</a>, <a href="2-trn.html#SP6">&#167;6</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_package</span><span class="plain-syntax"> *</span><span class="identifier-syntax">M</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_package</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax"> = </span><a href="2-sym.html#SP3" class="function-link"><span class="function-syntax">InterSymbol::package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><span class="identifier-syntax">P</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">P</span><span class="plain-syntax"> == </span><span class="identifier-syntax">M</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">P</span><span class="plain-syntax"> = </span><a href="2-pck.html#SP5" class="function-link"><span class="function-syntax">InterPackage::parent</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. </b>This is used only as a final criterion in sorting algorithms for symbols.
It assumes no table contains more than 100,000 symbols, which I think is a
pretty safe assumption, but in fact a violation of this would make no real
difference.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::sort_number</span><span class="plain-syntax">(</span><span class="reserved-syntax">const</span><span class="plain-syntax"> </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">100000</span><span class="plain-syntax"> * (</span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">owning_table</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">allocation_id</span><span class="plain-syntax">) +</span>
<span class="plain-syntax">        (</span><span class="reserved-syntax">int</span><span class="plain-syntax">) (</span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">symbol_ID</span><span class="plain-syntax"> - </span><span class="constant-syntax">SYMBOL_BASE_VAL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. Status.</b>The <a href="2-sym.html#SP1" class="internal">inter_symbol</a> structure could not really be called concise, but we
do make some effort, by packing various flags into a single <span class="extract"><span class="extract-syntax">symbol_status</span></span> field.
</p>

<p class="commentary">First, the "type" of a symbol is enumerated in these 3 bits:
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">MISC_ISYMT</span><span class="plain-syntax">               </span><span class="constant-syntax">0x00000000</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">PLUG_ISYMT</span><span class="plain-syntax">               </span><span class="constant-syntax">0x00000001</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">SOCKET_ISYMT</span><span class="plain-syntax">             </span><span class="constant-syntax">0x00000002</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">LABEL_ISYMT</span><span class="plain-syntax">              </span><span class="constant-syntax">0x00000003</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">LOCAL_ISYMT</span><span class="plain-syntax">              </span><span class="constant-syntax">0x00000004</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">SYMBOL_TYPE_STATUS_MASK</span><span class="plain-syntax">  </span><span class="constant-syntax">0x00000007</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::get_type</span><button class="popup" onclick="togglePopup('usagePopup4')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup4">Usage of <span class="code-font"><span class="function-syntax">InterSymbol::get_type</span></span>:<br/><a href="2-sym.html#SP9">&#167;9</a>, <a href="2-sym.html#SP11">&#167;11</a>, <a href="2-sym.html#SP12">&#167;12</a>, <a href="2-sym.html#SP13">&#167;13</a>, <a href="2-sym.html#SP14">&#167;14</a>, <a href="2-sym.html#SP18">&#167;18</a><br/>Inter in Binary Files - <a href="3-iibf.html#SP10_2_3_2_2">&#167;10.2.3.2.2</a><br/>The Plug Construct - <a href="6-tpc.html#SP3">&#167;3</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">symbol_status</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">SYMBOL_TYPE_STATUS_MASK</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::set_type</span><button class="popup" onclick="togglePopup('usagePopup5')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup5">Usage of <span class="code-font"><span class="function-syntax">InterSymbol::set_type</span></span>:<br/><a href="2-sym.html#SP9">&#167;9</a>, <a href="2-sym.html#SP10">&#167;10</a>, <a href="2-sym.html#SP11">&#167;11</a>, <a href="2-sym.html#SP12">&#167;12</a>, <a href="2-sym.html#SP13">&#167;13</a><br/>Inter in Binary Files - <a href="3-iibf.html#SP10_1_3_2_2">&#167;10.1.3.2.2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">V</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">symbol_status</span><span class="plain-syntax"> = </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">symbol_status</span><span class="plain-syntax"> - (</span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">symbol_status</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">SYMBOL_TYPE_STATUS_MASK</span><span class="plain-syntax">) + </span><span class="identifier-syntax">V</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>&#167;6. </b>Subsequent bits are used for miscellaneous persistent flags, and then after
that for some transient flags:
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">MAKE_NAME_UNIQUE_ISYMF</span><span class="plain-syntax">   </span><span class="constant-syntax">0x00000008</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">PERMIT_NAME_CLASH_ISYMF</span><span class="plain-syntax">     </span><span class="constant-syntax">0x00000010</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">METADATA_KEY_ISYMF</span><span class="plain-syntax">      </span><span class="constant-syntax">0x00000020</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">SYMBOL_FLAGS_STATUS_MASK</span><span class="plain-syntax"> </span><span class="constant-syntax">0x00000038</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">TRAVERSE_MARK_ISYMF</span><span class="plain-syntax">     </span><span class="constant-syntax">0x00000040</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">ATTRIBUTE_MARK_ISYMF</span><span class="plain-syntax">    </span><span class="constant-syntax">0x00000080</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">USED_MARK_ISYMF</span><span class="plain-syntax">          </span><span class="constant-syntax">0x00000100</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">SPECULATIVE_ISYMF</span><span class="plain-syntax">        </span><span class="constant-syntax">0x00000200</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">ATTRIBUTE_PROPERTY_MARK_ISYMF</span><span class="plain-syntax"> </span><span class="constant-syntax">0x00000400</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::get_flag</span><button class="popup" onclick="togglePopup('usagePopup6')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup6">Usage of <span class="code-font"><span class="function-syntax">InterSymbol::get_flag</span></span>:<br/><a href="2-sym.html#SP10">&#167;10</a><br/>Inter Constructs - <a href="3-ic.html#SP7">&#167;7</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">f</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no symbol"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">symbol_status</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">f</span><span class="plain-syntax">)?</span><span class="identifier-syntax">TRUE:FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::set_flag</span><button class="popup" onclick="togglePopup('usagePopup7')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup7">Usage of <span class="code-font"><span class="function-syntax">InterSymbol::set_flag</span></span>:<br/><a href="2-sym.html#SP10">&#167;10</a><br/>Inter in Text Files - <a href="3-iitf.html#SP12_14">&#167;12.14</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">f</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no symbol"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">symbol_status</span><span class="plain-syntax"> = </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">symbol_status</span><span class="plain-syntax"> | </span><span class="identifier-syntax">f</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::clear_flag</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">f</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no symbol"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">symbol_status</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">f</span><span class="plain-syntax">) </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">symbol_status</span><span class="plain-syntax"> = </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">symbol_status</span><span class="plain-syntax"> - </span><span class="identifier-syntax">f</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP7" class="paragraph-anchor"></a><b>&#167;7. </b>These are used when reading and writing binary Inter files: because of course
the data in the flags must persist when files are written out and read back again.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::get_persistent_flags</span><button class="popup" onclick="togglePopup('usagePopup8')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup8">Usage of <span class="code-font"><span class="function-syntax">InterSymbol::get_persistent_flags</span></span>:<br/>Inter in Binary Files - <a href="3-iibf.html#SP10_2_3_2_2">&#167;10.2.3.2.2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no symbol"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">symbol_status</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">SYMBOL_FLAGS_STATUS_MASK</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::set_persistent_flags</span><button class="popup" onclick="togglePopup('usagePopup9')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup9">Usage of <span class="code-font"><span class="function-syntax">InterSymbol::set_persistent_flags</span></span>:<br/>Inter in Binary Files - <a href="3-iibf.html#SP10_1_3_2_2">&#167;10.1.3.2.2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">x</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no symbol"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">symbol_status</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">symbol_status</span><span class="plain-syntax"> &amp; (~</span><span class="constant-syntax">SYMBOL_FLAGS_STATUS_MASK</span><span class="plain-syntax">)) | (</span><span class="identifier-syntax">x</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">SYMBOL_FLAGS_STATUS_MASK</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP8" class="paragraph-anchor"></a><b>&#167;8. </b>Transient flags convey no lasting meaning: they're used as workspace during
optimisations. The part of the word which must be preserved is:
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">NONTRANSIENT_SYMBOL_BITS</span><span class="plain-syntax"> (</span><span class="constant-syntax">SYMBOL_FLAGS_STATUS_MASK</span><span class="plain-syntax"> + </span><span class="constant-syntax">SYMBOL_TYPE_STATUS_MASK</span><span class="plain-syntax">)</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::clear_transient_flags</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">symbol_status</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">symbol_status</span><span class="plain-syntax">) &amp; </span><span class="constant-syntax">NONTRANSIENT_SYMBOL_BITS</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP9" class="paragraph-anchor"></a><b>&#167;9. Various sorts of symbol.</b>By far the most common symbols are the miscellaneous ones, which are destined
to be defined as constants, variables and the like.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::make_miscellaneous</span><button class="popup" onclick="togglePopup('usagePopup10')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup10">Usage of <span class="code-font"><span class="function-syntax">InterSymbol::make_miscellaneous</span></span>:<br/><a href="2-sym.html#SP2">&#167;2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><a href="2-sym.html#SP5" class="function-link"><span class="function-syntax">InterSymbol::set_type</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="constant-syntax">MISC_ISYMT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::misc_but_undefined</span><button class="popup" onclick="togglePopup('usagePopup11')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup11">Usage of <span class="code-font"><span class="function-syntax">InterSymbol::misc_but_undefined</span></span>:<br/>Inter in Text Files - <a href="3-iitf.html#SP4">&#167;4</a>, <a href="3-iitf.html#SP5_2">&#167;5.2</a><br/>Verifying Inter - <a href="3-vi.html#SP1_2_1">&#167;1.2.1</a>, <a href="3-vi.html#SP2">&#167;2</a>, <a href="3-vi.html#SP3">&#167;3</a>, <a href="3-vi.html#SP4">&#167;4</a><br/>Inter Value Pairs - <a href="3-ivp.html#SP22_2">&#167;22.2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">S</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">        (</span><a href="2-sym.html#SP5" class="function-link"><span class="function-syntax">InterSymbol::get_type</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">) == </span><span class="constant-syntax">MISC_ISYMT</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">        (</span><a href="2-sym.html#SP15" class="function-link"><span class="function-syntax">InterSymbol::is_defined</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP10" class="paragraph-anchor"></a><b>&#167;10. </b>Symbols whose names begin <span class="extract"><span class="extract-syntax">^</span></span> are metadata keys. Those should always be defined
as constants, cannot be wired, and are never compiled. See <a href="3-mtd.html" class="internal">Metadata</a> for more.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::is_metadata_key</span><button class="popup" onclick="togglePopup('usagePopup12')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup12">Usage of <span class="code-font"><span class="function-syntax">InterSymbol::is_metadata_key</span></span>:<br/><a href="2-sym.html#SP14">&#167;14</a>, <a href="2-sym.html#SP20">&#167;20</a>, <a href="2-sym.html#SP21">&#167;21</a>, <a href="2-sym.html#SP22">&#167;22</a><br/>The Wiring - <a href="2-tw2.html#SP5">&#167;5</a>, <a href="2-tw2.html#SP7">&#167;7</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="2-sym.html#SP6" class="function-link"><span class="function-syntax">InterSymbol::get_flag</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="constant-syntax">METADATA_KEY_ISYMF</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::make_metadata_key</span><button class="popup" onclick="togglePopup('usagePopup13')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup13">Usage of <span class="code-font"><span class="function-syntax">InterSymbol::make_metadata_key</span></span>:<br/><a href="2-sym.html#SP2">&#167;2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><a href="2-sym.html#SP5" class="function-link"><span class="function-syntax">InterSymbol::set_type</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="constant-syntax">MISC_ISYMT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-sym.html#SP6" class="function-link"><span class="function-syntax">InterSymbol::set_flag</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="constant-syntax">METADATA_KEY_ISYMF</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP11" class="paragraph-anchor"></a><b>&#167;11. </b>Labels are special symbols used to mark positions in function bodies to which
execution of code can jump. Their names must begin with a <span class="extract"><span class="extract-syntax">.</span></span>.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::is_label</span><button class="popup" onclick="togglePopup('usagePopup14')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup14">Usage of <span class="code-font"><span class="function-syntax">InterSymbol::is_label</span></span>:<br/>The Lab Construct - <a href="5-tlc.html#SP3">&#167;3</a>, <a href="5-tlc.html#SP4">&#167;4</a><br/>The Label Construct - <a href="5-tlc2.html#SP3">&#167;3</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">S</span><span class="plain-syntax">) &amp;&amp; (</span><a href="2-sym.html#SP5" class="function-link"><span class="function-syntax">InterSymbol::get_type</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">) == </span><span class="constant-syntax">LABEL_ISYMT</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::make_label</span><button class="popup" onclick="togglePopup('usagePopup15')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup15">Usage of <span class="code-font"><span class="function-syntax">InterSymbol::make_label</span></span>:<br/>The Lab Construct - <a href="5-tlc.html#SP4">&#167;4</a><br/>The Label Construct - <a href="5-tlc2.html#SP4">&#167;4</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::get_first_char</span><span class="plain-syntax">(</span><a href="2-sym.html#SP19" class="function-link"><span class="function-syntax">InterSymbol::identifier</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">)) != </span><span class="character-syntax">'.'</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"not a label name"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-sym.html#SP5" class="function-link"><span class="function-syntax">InterSymbol::set_type</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="constant-syntax">LABEL_ISYMT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">definition</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP12" class="paragraph-anchor"></a><b>&#167;12. </b>Local variable names behave very similarly, but have no naming convention.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::is_local</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">S</span><span class="plain-syntax">) &amp;&amp; (</span><a href="2-sym.html#SP5" class="function-link"><span class="function-syntax">InterSymbol::get_type</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">) == </span><span class="constant-syntax">LOCAL_ISYMT</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::make_local</span><button class="popup" onclick="togglePopup('usagePopup16')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup16">Usage of <span class="code-font"><span class="function-syntax">InterSymbol::make_local</span></span>:<br/>The Local Construct - <a href="5-tlc3.html#SP4">&#167;4</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><a href="2-sym.html#SP5" class="function-link"><span class="function-syntax">InterSymbol::set_type</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="constant-syntax">LOCAL_ISYMT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">definition</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP13" class="paragraph-anchor"></a><b>&#167;13. </b>Connectors are symbols used either as plugs or sockets. These only appear
in one special package, and are used to link different trees together.
See <a href="2-tw2.html" class="internal">The Wiring</a>.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::is_plug</span><button class="popup" onclick="togglePopup('usagePopup17')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup17">Usage of <span class="code-font"><span class="function-syntax">InterSymbol::is_plug</span></span>:<br/>The Wiring - <a href="2-tw2.html#SP14">&#167;14</a>, <a href="2-tw2.html#SP15">&#167;15</a>, <a href="2-tw2.html#SP17">&#167;17</a><br/>Transmigration - <a href="2-trn.html#SP5_2_2">&#167;5.2.2</a><br/>Inter in Binary Files - <a href="3-iibf.html#SP10_1_3_2_2">&#167;10.1.3.2.2</a>, <a href="3-iibf.html#SP10_2_3_2_2">&#167;10.2.3.2.2</a><br/>Inter in Text Files - <a href="3-iitf.html#SP7">&#167;7</a><br/>The Package Construct - <a href="4-tpc.html#SP8">&#167;8</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">S</span><span class="plain-syntax">) &amp;&amp; (</span><a href="2-sym.html#SP5" class="function-link"><span class="function-syntax">InterSymbol::get_type</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">) == </span><span class="constant-syntax">PLUG_ISYMT</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::make_plug</span><button class="popup" onclick="togglePopup('usagePopup18')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup18">Usage of <span class="code-font"><span class="function-syntax">InterSymbol::make_plug</span></span>:<br/>The Wiring - <a href="2-tw2.html#SP14">&#167;14</a><br/>The Plug Construct - <a href="6-tpc.html#SP2">&#167;2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><a href="2-sym.html#SP5" class="function-link"><span class="function-syntax">InterSymbol::set_type</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="constant-syntax">PLUG_ISYMT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">definition</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::is_socket</span><button class="popup" onclick="togglePopup('usagePopup19')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup19">Usage of <span class="code-font"><span class="function-syntax">InterSymbol::is_socket</span></span>:<br/>The Wiring - <a href="2-tw2.html#SP11">&#167;11</a>, <a href="2-tw2.html#SP12">&#167;12</a>, <a href="2-tw2.html#SP16">&#167;16</a>, <a href="2-tw2.html#SP17">&#167;17</a><br/>Transmigration - <a href="2-trn.html#SP3_5">&#167;3.5</a><br/>Inter in Text Files - <a href="3-iitf.html#SP7_1">&#167;7.1</a><br/>The Package Construct - <a href="4-tpc.html#SP8">&#167;8</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">S</span><span class="plain-syntax">) &amp;&amp; (</span><a href="2-sym.html#SP5" class="function-link"><span class="function-syntax">InterSymbol::get_type</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">) == </span><span class="constant-syntax">SOCKET_ISYMT</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::make_socket</span><button class="popup" onclick="togglePopup('usagePopup20')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup20">Usage of <span class="code-font"><span class="function-syntax">InterSymbol::make_socket</span></span>:<br/>The Wiring - <a href="2-tw2.html#SP13">&#167;13</a><br/>The Socket Construct - <a href="6-tsc.html#SP2">&#167;2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><a href="2-sym.html#SP5" class="function-link"><span class="function-syntax">InterSymbol::set_type</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="constant-syntax">SOCKET_ISYMT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">definition</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::is_connector</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><a href="2-sym.html#SP13" class="function-link"><span class="function-syntax">InterSymbol::is_plug</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">)) || (</span><a href="2-sym.html#SP13" class="function-link"><span class="function-syntax">InterSymbol::is_socket</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">))) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP14" class="paragraph-anchor"></a><b>&#167;14. </b>A symbol is "private" if it cannot be seen from outside the package, that is,
if no external symbol is allowed to be wired to it. For example, local variables
in a function body have this property.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::private</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-sym.html#SP5" class="function-link"><span class="function-syntax">InterSymbol::get_type</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">) == </span><span class="constant-syntax">LABEL_ISYMT</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-sym.html#SP5" class="function-link"><span class="function-syntax">InterSymbol::get_type</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">) == </span><span class="constant-syntax">LOCAL_ISYMT</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-sym.html#SP10" class="function-link"><span class="function-syntax">InterSymbol::is_metadata_key</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP15" class="paragraph-anchor"></a><b>&#167;15. Definition of a symbol.</b>When created, a symbol is "undefined": it has no meaning as yet, though it is
usually given one very soon after creation. Even then, though, definitions are
sometimes changed later on.
</p>

<p class="commentary">Giving a symbol a definition says that it means something right here, in the
package to which it belongs. The alternative is to wire it, which says that the
meaning is far away, in another package: see <a href="2-tw2.html" class="internal">The Wiring</a>.
</p>

<p class="commentary">A definition in this sense is a pointer to an <a href="2-in.html#SP1" class="internal">inter_tree_node</a> holding an
instruction which creates the symbol. For example, the definition of <span class="extract"><span class="extract-syntax">magic_number</span></span>
might be the node holding the instruction:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">constant</span><span class="plain-syntax"> magic_number </span><span class="identifier-syntax">K_int32</span><span class="plain-syntax"> = </span><span class="constant-syntax">27</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::define</span><button class="popup" onclick="togglePopup('usagePopup21')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup21">Usage of <span class="code-font"><span class="function-syntax">InterSymbol::define</span></span>:<br/>Verifying Inter - <a href="3-vi.html#SP1_2_1">&#167;1.2.1</a>, <a href="3-vi.html#SP1_2_2">&#167;1.2.2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"tried to define null symbol"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">definition</span><span class="plain-syntax"> = </span><span class="identifier-syntax">P</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::undefine</span><button class="popup" onclick="togglePopup('usagePopup22')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup22">Usage of <span class="code-font"><span class="function-syntax">InterSymbol::undefine</span></span>:<br/><a href="2-sym.html#SP16">&#167;16</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax">) </span><a href="2-sym.html#SP15" class="function-link"><span class="function-syntax">InterSymbol::define</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="function-syntax">InterSymbol::definition</span><button class="popup" onclick="togglePopup('usagePopup23')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup23">Usage of <span class="code-font"><span class="function-syntax">InterSymbol::definition</span></span>:<br/><a href="2-sym.html#SP16">&#167;16</a>, <a href="2-sym.html#SP17">&#167;17</a><br/>Inter in Text Files - <a href="3-iitf.html#SP5_2">&#167;5.2</a><br/>Verifying Inter - <a href="3-vi.html#SP1_2_1">&#167;1.2.1</a>, <a href="3-vi.html#SP1_2_2">&#167;1.2.2</a>, <a href="3-vi.html#SP2">&#167;2</a>, <a href="3-vi.html#SP3">&#167;3</a>, <a href="3-vi.html#SP4">&#167;4</a><br/>Inter Data Types - <a href="3-idt.html#SP24">&#167;24</a><br/>The Constant Construct - <a href="4-tcc2.html#SP9">&#167;9</a>, <a href="4-tcc2.html#SP10">&#167;10</a>, <a href="4-tcc2.html#SP11">&#167;11</a><br/>The Instance Construct - <a href="4-tic2.html#SP6">&#167;6</a><br/>The Package Construct - <a href="4-tpc.html#SP9">&#167;9</a><br/>The Primitive Construct - <a href="4-tpc5.html#SP6">&#167;6</a>, <a href="4-tpc5.html#SP8">&#167;8</a><br/>The Property Construct - <a href="4-tpc6.html#SP6">&#167;6</a><br/>The PropertyValue Construct - <a href="4-tpc7.html#SP4">&#167;4</a><br/>The Provenance Construct - <a href="4-tpc8.html#SP4">&#167;4</a>, <a href="4-tpc8.html#SP7">&#167;7</a><br/>The Typename Construct - <a href="4-ttc.html#SP6">&#167;6</a>, <a href="4-ttc.html#SP7">&#167;7</a>, <a href="4-ttc.html#SP8">&#167;8</a>, <a href="4-ttc.html#SP9">&#167;9</a>, <a href="4-ttc.html#SP10">&#167;10</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"tried to find definition of null symbol"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">definition</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::is_defined</span><button class="popup" onclick="togglePopup('usagePopup24')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup24">Usage of <span class="code-font"><span class="function-syntax">InterSymbol::is_defined</span></span>:<br/><a href="2-sym.html#SP9">&#167;9</a><br/>Transmigration - <a href="2-trn.html#SP3_5_1">&#167;3.5.1</a><br/>Inter Constructs - <a href="3-ic.html#SP7">&#167;7</a><br/>Verifying Inter - <a href="3-vi.html#SP1_2_2">&#167;1.2.2</a><br/>The Label Construct - <a href="5-tlc2.html#SP4">&#167;4</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-sym.html#SP15" class="function-link"><span class="function-syntax">InterSymbol::definition</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP16" class="paragraph-anchor"></a><b>&#167;16. </b>This is rather more violent than simply undefining <span class="extract"><span class="extract-syntax">S</span></span>. It does do that,
but also deletes the instruction which had defined <span class="extract"><span class="extract-syntax">S</span></span> from the tree entirely.
</p>

<p class="commentary">Note that it does not go to the even more extreme lengths of removing the
symbol from the symbols table. For that, see <a href="2-st.html#SP21" class="internal">InterSymbolsTable::remove_symbol</a>,
but see also the warnings attached to it.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::strike_definition</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">D</span><span class="plain-syntax"> = </span><a href="2-sym.html#SP15" class="function-link"><span class="function-syntax">InterSymbol::definition</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">D</span><span class="plain-syntax">) </span><a href="2-np.html#SP1" class="function-link"><span class="function-syntax">NodePlacement::remove</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-sym.html#SP15" class="function-link"><span class="function-syntax">InterSymbol::undefine</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP17" class="paragraph-anchor"></a><b>&#167;17. </b>Symbols which define integer constants occasionally need to be evaluated or
modified, which of course means looking into their defining instructions.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::evaluate_to_int</span><button class="popup" onclick="togglePopup('usagePopup25')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup25">Usage of <span class="code-font"><span class="function-syntax">InterSymbol::evaluate_to_int</span></span>:<br/>The Constant Construct - <a href="4-tcc2.html#SP10">&#167;10</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax"> = </span><a href="2-sym.html#SP15" class="function-link"><span class="function-syntax">InterSymbol::definition</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-in.html#SP13" class="function-link"><span class="function-syntax">Inode::is</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">CONSTANT_IST</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="4-tcc2.html#SP10" class="function-link"><span class="function-syntax">ConstantInstruction::evaluate_to_int</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> -1;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::set_int</span><button class="popup" onclick="togglePopup('usagePopup26')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup26">Usage of <span class="code-font"><span class="function-syntax">InterSymbol::set_int</span></span>:<br/>The Constant Construct - <a href="4-tcc2.html#SP11">&#167;11</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">N</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax"> = </span><a href="2-sym.html#SP15" class="function-link"><span class="function-syntax">InterSymbol::definition</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><a href="2-in.html#SP13" class="function-link"><span class="function-syntax">Inode::is</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">CONSTANT_IST</span><span class="plain-syntax">)) &amp;&amp; (</span><a href="4-tcc2.html#SP11" class="function-link"><span class="function-syntax">ConstantInstruction::set_int</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">N</span><span class="plain-syntax">))) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">P</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"Symbol $3 is undefined\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"Symbol $3 cannot be set to %d\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">N</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"unable to set symbol"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP18" class="paragraph-anchor"></a><b>&#167;18. </b>A symbol wired to something in another package, or a plug &mdash; which is not
yet wired, but will be later on, when linking takes place &mdash; has no definition
in the current package. So:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::defined_elsewhere</span><button class="popup" onclick="togglePopup('usagePopup27')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup27">Usage of <span class="code-font"><span class="function-syntax">InterSymbol::defined_elsewhere</span></span>:<br/>Inter in Text Files - <a href="3-iitf.html#SP5_2">&#167;5.2</a><br/>Verifying Inter - <a href="3-vi.html#SP2">&#167;2</a>, <a href="3-vi.html#SP3">&#167;3</a>, <a href="3-vi.html#SP4">&#167;4</a><br/>Inter Value Pairs - <a href="3-ivp.html#SP22_2">&#167;22.2</a><br/>Inter Data Types - <a href="3-idt.html#SP24">&#167;24</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-tw2.html#SP2" class="function-link"><span class="function-syntax">Wiring::is_wired</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-sym.html#SP5" class="function-link"><span class="function-syntax">InterSymbol::get_type</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">) == </span><span class="constant-syntax">PLUG_ISYMT</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP19" class="paragraph-anchor"></a><b>&#167;19. Identifier name.</b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="function-syntax">InterSymbol::identifier</span><button class="popup" onclick="togglePopup('usagePopup28')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup28">Usage of <span class="code-font"><span class="function-syntax">InterSymbol::identifier</span></span>:<br/><a href="2-sym.html#SP11">&#167;11</a>, <a href="2-sym.html#SP20">&#167;20</a><br/>Packages - <a href="2-pck.html#SP7">&#167;7</a><br/>Symbols Tables - <a href="2-st.html#SP5_2">&#167;5.2</a>, <a href="2-st.html#SP5_3_3">&#167;5.3.3</a>, <a href="2-st.html#SP6">&#167;6</a>, <a href="2-st.html#SP16_1_2">&#167;16.1.2</a>, <a href="2-st.html#SP18">&#167;18</a><br/>The Wiring - <a href="2-tw2.html#SP5">&#167;5</a>, <a href="2-tw2.html#SP5_1">&#167;5.1</a><br/>Transmigration - <a href="2-trn.html#SP3_5_1">&#167;3.5.1</a>, <a href="2-trn.html#SP5_1">&#167;5.1</a>, <a href="2-trn.html#SP5_1_1">&#167;5.1.1</a>, <a href="2-trn.html#SP5_2_1">&#167;5.2.1</a>, <a href="2-trn.html#SP5_2_1_1">&#167;5.2.1.1</a>, <a href="2-trn.html#SP5_2_2_1">&#167;5.2.2.1</a>, <a href="2-trn.html#SP5_2_2_3">&#167;5.2.2.3</a>, <a href="2-trn.html#SP6_1">&#167;6.1</a><br/>Inter Constructs - <a href="3-ic.html#SP7">&#167;7</a><br/>Inter in Binary Files - <a href="3-iibf.html#SP10_2_3_2_2">&#167;10.2.3.2.2</a><br/>Inter in Text Files - <a href="3-iitf.html#SP10">&#167;10</a><br/>Verifying Inter - <a href="3-vi.html#SP1_2_1">&#167;1.2.1</a>, <a href="3-vi.html#SP1_2_2">&#167;1.2.2</a>, <a href="3-vi.html#SP2">&#167;2</a>, <a href="3-vi.html#SP3">&#167;3</a>, <a href="3-vi.html#SP4">&#167;4</a><br/>Inter Value Pairs - <a href="3-ivp.html#SP22_2">&#167;22.2</a><br/>The Constant Construct - <a href="4-tcc2.html#SP7">&#167;7</a>, <a href="4-tcc2.html#SP9">&#167;9</a><br/>The Instance Construct - <a href="4-tic2.html#SP5">&#167;5</a><br/>The Origin Construct - <a href="4-toc.html#SP5">&#167;5</a><br/>The Package Construct - <a href="4-tpc.html#SP4">&#167;4</a>, <a href="4-tpc.html#SP7">&#167;7</a><br/>The PackageType Construct - <a href="4-tpc2.html#SP4">&#167;4</a><br/>The Permission Construct - <a href="4-tpc3.html#SP3">&#167;3</a><br/>The Primitive Construct - <a href="4-tpc5.html#SP3">&#167;3</a>, <a href="4-tpc5.html#SP5">&#167;5</a><br/>The Property Construct - <a href="4-tpc6.html#SP5">&#167;5</a><br/>The PropertyValue Construct - <a href="4-tpc7.html#SP3">&#167;3</a><br/>The Provenance Construct - <a href="4-tpc8.html#SP6">&#167;6</a><br/>The Typename Construct - <a href="4-ttc.html#SP5">&#167;5</a><br/>The Variable Construct - <a href="4-tvc.html#SP5">&#167;5</a><br/>The Inv Construct - <a href="5-tic.html#SP5_2">&#167;5.2</a>, <a href="5-tic.html#SP5_3">&#167;5.3</a>, <a href="5-tic.html#SP8">&#167;8</a><br/>The Lab Construct - <a href="5-tlc.html#SP5">&#167;5</a><br/>The Label Construct - <a href="5-tlc2.html#SP3">&#167;3</a>, <a href="5-tlc2.html#SP5">&#167;5</a><br/>The Local Construct - <a href="5-tlc3.html#SP5">&#167;5</a><br/>The Plug Construct - <a href="6-tpc.html#SP3">&#167;3</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">identifier</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP20" class="paragraph-anchor"></a><b>&#167;20. Translation.</b>Any symbol can be marked with a "translation", which is the textual identifier
to use when compiling final code which refers to it. For example, if our
example constant is defined by:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">constant</span><span class="plain-syntax"> magic_number </span><span class="identifier-syntax">K_int32</span><span class="plain-syntax"> = </span><span class="constant-syntax">27</span>
</pre>
<p class="commentary">then its translated form would normally just be <span class="extract"><span class="extract-syntax">"magic_number"</span></span> &mdash; the same
as its identifier name in Inter. Any Inform 6 code generated to refer to this
might then read:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"The magic number is "</span><span class="plain-syntax">, </span><span class="identifier-syntax">magic_number</span><span class="plain-syntax">, </span><span class="string-syntax">"."</span><span class="plain-syntax">;</span>
</pre>
<p class="commentary">But if the <span class="extract"><span class="extract-syntax">magic_number</span></span> had been given the translation text <span class="extract"><span class="extract-syntax">"SHAZAM"</span></span>, that
same Inter would compile instead to:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"The magic number is "</span><span class="plain-syntax">, </span><span class="identifier-syntax">SHAZAM</span><span class="plain-syntax">, </span><span class="string-syntax">"."</span><span class="plain-syntax">;</span>
</pre>
<p class="commentary">There is something a little disorienting about storing this data as part of
an <a href="2-sym.html#SP1" class="internal">inter_symbol</a>. One might reasonably say: It's no business of the Inter
tree what the <a href="../final-module/index.html" class="internal">final</a> module chooses to call its identifiers, and anyway,
maybe the target language compiled to doesn't even have identifiers in any
recognisable way, or insists that they follow COBOL naming conventions, or
something equally annoying.
</p>

<p class="commentary">However, we have to store translations within the Inter tree because the
Inform 7 language includes low-level features which cannot be expressed any
other way:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">The</span><span class="plain-syntax"> </span><span class="identifier-syntax">tally</span><span class="plain-syntax"> </span><span class="identifier-syntax">is</span><span class="plain-syntax"> </span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">number</span><span class="plain-syntax"> </span><span class="identifier-syntax">that</span><span class="plain-syntax"> </span><span class="identifier-syntax">varies</span><span class="plain-syntax">.</span>
<span class="identifier-syntax">The</span><span class="plain-syntax"> </span><span class="identifier-syntax">tally</span><span class="plain-syntax"> </span><span class="identifier-syntax">translates</span><span class="plain-syntax"> </span><span class="identifier-syntax">into</span><span class="plain-syntax"> </span><span class="identifier-syntax">Inter</span><span class="plain-syntax"> </span><span class="identifier-syntax">as</span><span class="plain-syntax"> </span><span class="string-syntax">"SHAZAM"</span><span class="plain-syntax">.</span>
</pre>
<p class="commentary">In order for this instruction to reach the <a href="../final-module/index.html" class="internal">final</a> code generators, this
data clearly has to be expressed in the Inter tree. Well, this is where.
</p>

<p class="commentary">With that apologia out of the way, the translation text is held in the
annotation <span class="extract"><span class="extract-syntax">_translation</span></span>:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::set_translate</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">identifier</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no symbol"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-sym.html#SP10" class="function-link"><span class="function-syntax">InterSymbol::is_metadata_key</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><a href="2-ann.html#SP6" class="function-link"><span class="function-syntax">SymbolAnnotation::set_t</span></a><span class="plain-syntax">(</span><a href="2-pck.html#SP4" class="function-link"><span class="function-syntax">InterPackage::tree</span></a><span class="plain-syntax">(</span><a href="2-sym.html#SP3" class="function-link"><span class="function-syntax">InterSymbol::package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">)),</span>
<span class="plain-syntax">            </span><a href="2-sym.html#SP3" class="function-link"><span class="function-syntax">InterSymbol::package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">), </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="constant-syntax">TRANSLATION_IANN</span><span class="plain-syntax">, </span><span class="identifier-syntax">identifier</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="function-syntax">InterSymbol::get_translate</span><button class="popup" onclick="togglePopup('usagePopup29')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup29">Usage of <span class="code-font"><span class="function-syntax">InterSymbol::get_translate</span></span>:<br/><a href="2-sym.html#SP23">&#167;23</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no symbol"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="2-ann.html#SP7" class="function-link"><span class="function-syntax">SymbolAnnotation::get_t</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><a href="2-pck.html#SP4" class="function-link"><span class="function-syntax">InterPackage::tree</span></a><span class="plain-syntax">(</span><a href="2-sym.html#SP3" class="function-link"><span class="function-syntax">InterSymbol::package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">)), </span><span class="constant-syntax">TRANSLATION_IANN</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="function-syntax">InterSymbol::trans</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-sym.html#SP20" class="function-link"><span class="function-syntax">InterSymbol::get_translate</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="2-sym.html#SP20" class="function-link"><span class="function-syntax">InterSymbol::get_translate</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="2-sym.html#SP19" class="function-link"><span class="function-syntax">InterSymbol::identifier</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP21" class="paragraph-anchor"></a><b>&#167;21. Replacement.</b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::set_replacement</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">from</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no symbol"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-sym.html#SP10" class="function-link"><span class="function-syntax">InterSymbol::is_metadata_key</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><a href="2-ann.html#SP6" class="function-link"><span class="function-syntax">SymbolAnnotation::set_t</span></a><span class="plain-syntax">(</span><a href="2-pck.html#SP4" class="function-link"><span class="function-syntax">InterPackage::tree</span></a><span class="plain-syntax">(</span><a href="2-sym.html#SP3" class="function-link"><span class="function-syntax">InterSymbol::package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">)),</span>
<span class="plain-syntax">            </span><a href="2-sym.html#SP3" class="function-link"><span class="function-syntax">InterSymbol::package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">), </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="constant-syntax">REPLACING_IANN</span><span class="plain-syntax">, </span><span class="identifier-syntax">from</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="function-syntax">InterSymbol::get_replacement</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no symbol"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="2-ann.html#SP7" class="function-link"><span class="function-syntax">SymbolAnnotation::get_t</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><a href="2-pck.html#SP4" class="function-link"><span class="function-syntax">InterPackage::tree</span></a><span class="plain-syntax">(</span><a href="2-sym.html#SP3" class="function-link"><span class="function-syntax">InterSymbol::package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">)), </span><span class="constant-syntax">REPLACING_IANN</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP22" class="paragraph-anchor"></a><b>&#167;22. Namespace.</b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::set_namespace</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">from</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no symbol"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-sym.html#SP10" class="function-link"><span class="function-syntax">InterSymbol::is_metadata_key</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><a href="2-ann.html#SP6" class="function-link"><span class="function-syntax">SymbolAnnotation::set_t</span></a><span class="plain-syntax">(</span><a href="2-pck.html#SP4" class="function-link"><span class="function-syntax">InterPackage::tree</span></a><span class="plain-syntax">(</span><a href="2-sym.html#SP3" class="function-link"><span class="function-syntax">InterSymbol::package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">)),</span>
<span class="plain-syntax">            </span><a href="2-sym.html#SP3" class="function-link"><span class="function-syntax">InterSymbol::package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">), </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="constant-syntax">NAMESPACE_IANN</span><span class="plain-syntax">, </span><span class="identifier-syntax">from</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="function-syntax">InterSymbol::get_namespace</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no symbol"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="2-ann.html#SP7" class="function-link"><span class="function-syntax">SymbolAnnotation::get_t</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><a href="2-pck.html#SP4" class="function-link"><span class="function-syntax">InterPackage::tree</span></a><span class="plain-syntax">(</span><a href="2-sym.html#SP3" class="function-link"><span class="function-syntax">InterSymbol::package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">)), </span><span class="constant-syntax">NAMESPACE_IANN</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP23" class="paragraph-anchor"></a><b>&#167;23. Logging.</b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">InterSymbol::log</span><button class="popup" onclick="togglePopup('usagePopup30')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup30">Usage of <span class="code-font"><span class="function-syntax">InterSymbol::log</span></span>:<br/>Bytecode Module - <a href="1-bm.html#SP3_4">&#167;3.4</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">void</span><span class="plain-syntax"> *</span><span class="identifier-syntax">vs</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax"> = (</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *) </span><span class="identifier-syntax">vs</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"&lt;no-symbol&gt;"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><a href="2-st.html#SP18" class="function-link"><span class="function-syntax">InterSymbolsTable::write_symbol_URL</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">DL</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"{%d}"</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">symbol_ID</span><span class="plain-syntax"> - </span><span class="constant-syntax">SYMBOL_BASE_VAL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">trans</span><span class="plain-syntax"> = </span><a href="2-sym.html#SP20" class="function-link"><span class="function-syntax">InterSymbol::get_translate</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">trans</span><span class="plain-syntax">) &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"'%S'"</span><span class="plain-syntax">, </span><span class="identifier-syntax">trans</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="2-st.html">&#10094;</a></li><li class="progresschapter"><a href="P-wtmd.html">P</a></li><li class="progresschapter"><a href="1-bm.html">1</a></li><li class="progresscurrentchapter">2</li><li class="progresssection"><a href="2-it.html">it</a></li><li class="progresssection"><a href="2-in.html">in</a></li><li class="progresssection"><a href="2-bkm.html">bkm</a></li><li class="progresssection"><a href="2-np.html">np</a></li><li class="progresssection"><a href="2-tw.html">tw</a></li><li class="progresssection"><a href="2-pck.html">pck</a></li><li class="progresssection"><a href="2-inl.html">inl</a></li><li class="progresssection"><a href="2-st.html">st</a></li><li class="progresscurrent">sym</li><li class="progresssection"><a href="2-ann.html">ann</a></li><li class="progresssection"><a href="2-tw2.html">tw2</a></li><li class="progresssection"><a href="2-trn.html">trn</a></li><li class="progresschapter"><a href="3-ic.html">3</a></li><li class="progresschapter"><a href="4-tcc.html">4</a></li><li class="progresschapter"><a href="5-tac.html">5</a></li><li class="progresschapter"><a href="6-tpc.html">6</a></li><li class="progressnext"><a href="2-ann.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

